import type { SubCategory } from '@/types';
import { http } from '@/utils/request';
import { defineStore } from 'pinia';

export const useCateStore = defineStore('cart', {
  state: () => {
    return {
      subCategory: {} as SubCategory,
    };
  },
  actions: {
    async getSubFilter(id: string) {
      const res = await http<SubCategory>('get', '/category/sub/filter', {
        id,
      });
      this.subCategory = res.data.result;
      console.log(this.subCategory);
    },
  },
});
